﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace Trackr.GUI.Views
{
	public partial class DayView : UserControl
	{
	    public DateTime Day { get; set; }

	    public DayView()
		{
			this.InitializeComponent();
		}
		public DayView(DateTime date, TimeSpan totalDayTime)
		{
		    Day = date;
            this.InitializeComponent();
            TotalDayTime.Content = totalDayTime.ToString(@"hh\:mm");
			this.LabelDate.Content = date.ToString("MMM dd");
            LabelDate.MouseDoubleClick += LabelDate_MouseDoubleClick;
		    InitDayHeight();
		}

	    private void InitDayHeight()
	    {
	        if (Day.Day != DateTime.Now.Day)
	            stackPanelTimeItems.Visibility = Visibility.Collapsed;
	    }

	    private void LabelDate_MouseDoubleClick(object sender, MouseButtonEventArgs e)
	    {
	        stackPanelTimeItems.Visibility = stackPanelTimeItems.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
	    }
	}
}
